<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
	
  $logoutGoTo = "../private/login.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && true) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "../private/login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) 
  $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php require_once('../Connections/miportal.php'); 
mysql_query("SET NAMES 'utf8'");?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_rsExpediente = "-1";
if (isset($_GET['id_cor_candidato'])) {
  $colname_rsExpediente = base64_decode($_GET['id_cor_candidato']);
}

mysql_select_db($database_miportal, $miportal);
$query_rsExpediente = sprintf("SELECT * FROM cor_ben_ies_emp WHERE id_cor_candidato = %s", GetSQLValueString($colname_rsExpediente, "text"));
$rsExpediente = mysql_query($query_rsExpediente, $miportal) or die(mysql_error());
$row_rsExpediente = mysql_fetch_assoc($rsExpediente);
$totalRows_rsExpediente = mysql_num_rows($rsExpediente);

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "formUpdateCandidatoExpediente")) {
  $insertSQL = sprintf("UPDATE cor_ben_ies_emp SET fh_iniActividades=%s, fh_finActividades=%s WHERE id_cor_candidato=%s",
                       
                       GetSQLValueString($_POST['insIniActividades'], "date"),
                       GetSQLValueString($_POST['insFinActividades'], "date"),
					   GetSQLValueString($_POST['id_cor_candidato'], "int"));  
					   
  mysql_select_db($database_miportal, $miportal);
  $Result1 = mysql_query($insertSQL, $miportal) or die(mysql_error());
    
  $updateGoTo = "../report/report_dve_candidatos.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}

$colname_rsExpediente = "-1";
if (isset($_GET['id_cor_candidato'])) {
  $colname_rsExpediente = base64_decode($_GET['id_cor_candidato']);
}

mysql_select_db($database_miportal, $miportal);
$query_rsExpediente = sprintf("SELECT * FROM cor_ben_ies_emp WHERE id_cor_candidato = %s", GetSQLValueString($colname_rsExpediente, "text"));
$rsExpediente = mysql_query($query_rsExpediente, $miportal) or die(mysql_error());
$row_rsExpediente = mysql_fetch_assoc($rsExpediente);
$totalRows_rsExpediente = mysql_num_rows($rsExpediente);






 ?>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximun-scale=1">
<title>FUNDACIÓN EDUCACIÓN SUPERIOR-EMPRESA</title>
<!--Hoja de estilo principal-->
<link href="../css/styletd2.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="stylesheet" type="text/css" href="../css/mos-style.css">
<link rel="stylesheet" type="text/css" href="../css/menu.css">
<link href="../SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css">
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">
<!--Pemanggilan gambar favicon-->
 <!--pemanggilan file css-->
 <script src="../SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script><script language=""="JavaScript">
	function conMayusculas(field) {
				field.value = field.value.toUpperCase()
		}
	function confirmar ( mensaje ) {
					return confirm( mensaje );
				}
        </script>
        
<script><!--SCRIPT AJAX MUNICIPIO-->
	function showMunicipio(str)
	{
		if (str=="")
		  {
		  document.getElementById("municipio").innerHTML="";
		  return;
		  } 
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  	  }
		xmlhttp.onreadystatechange=function()
		  {
			  if (xmlhttp.readyState==4 && xmlhttp.status==200)
				{
				document.getElementById("municipio").innerHTML=xmlhttp.responseText;
			}
	  }
	xmlhttp.open("GET","../lib/utils/getMunicipio.php?q="+str,true);
	xmlhttp.send();
	}
</script>     
<script><!--SCRIPT AJAX Carrera-->
	function showCarrera(str)
	{
		if (str=="")
		  {
		  document.getElementById("insCarrera").innerHTML="";
		  return;
		  } 
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  	  }
		xmlhttp.onreadystatechange=function()
		  {
			  if (xmlhttp.readyState==4 && xmlhttp.status==200)
				{
				document.getElementById("insCarrera").innerHTML=xmlhttp.responseText;
			}
	  }
	xmlhttp.open("GET","../lib/utils/getCarrera.php?q="+str,true);
	xmlhttp.send();
	}
</script>   
<script><!--SCRIPT AJAX Otra Carrera-->
	function showOtraCarrera(str)
	{
		if (str=="")
		  {
		  document.getElementById("OtraCarrera").innerHTML="";
		  return;
		  } 
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  	  }
		xmlhttp.onreadystatechange=function()
		  {
			  if (xmlhttp.readyState==4 && xmlhttp.status==200)
				{
				document.getElementById("OtraCarrera").innerHTML=xmlhttp.responseText;
			}
	  }
	xmlhttp.open("GET","../lib/utils/getOtraCarrera.php?q="+str,true);
	xmlhttp.send();
	}
</script>
</head>
<body>

<header>
        <div id="background"></div><!--BackGround Menu header-->
		<div class="img_header_logo"></div>
		<span class="img_header_logo"><a href="http://fese.org.mx"><img src="../images/fese/FESE_home_logo.png"  height="90" alt="FESE" align="bottom" /></a></span>
		<div class="img_header_logo"></div>
		<?php include_once('../include/dve_nav.php');?>
</header>

<center>
<div id="boxcontainer">
<div id="container">


<form action="<?php echo $editFormAction; ?>" method="POST" name="formUpdateCandidatoExpediente">

<table name="t_candidato" width="720px" border="1">
	<tr>
		<td colspan="2"><h3>REGISTRO DE FECHAS:
        <input name="id_cor_candidato" type="hidden" id="id_cor_candidato" value="<?php echo $row_rsExpediente['id_cor_candidato']; ?>">
		</h3></td>
		</tr>
	<tr>

	<tr>
		<td>Fecha de inicio de actividades</td>
		<td><span id="inicio">
        <input type="text" name="insIniActividades" id="insInicio" onChange="conMayusculas(this)" style="width:280px" value="<?php echo $row_rsExpediente['fh_iniActividades']; ?>">
       </span></td>
	</tr>
	 
	<tr>
		<td>Fecha de fin de Actividades</td>
		<td><span id="fin">
        <input type="text" name="insFinActividades" id="insFin" onChange="conMayusculas(this)" style="width:280px" value="<?php echo $row_rsExpediente['fh_finActividades']; ?>">
        </span></td>
	</tr>
		
	
	 
	<tr>
		<td colspan="2" style="text-align:right"><input type="submit" class="button" value="Guardar y continuar" onClick="return confirmar('¿Esta seguro que desea registrar los datos ingresados?')"></td>
		</tr>
</table>
<input type="hidden" name="MM_update" value="formUpdateCandidatoExpediente">
</form>
</div>
<!--Container-->
<div id="rightContainer">
    <div id="Bienvenida">
    <div id="cuadro">
    <h1>Bienvenido</h1>
    </div>
    
    <div >
    <br>
            <?php echo $_SESSION['MM_UsName'] ?><br><br>
            <?php echo $_SESSION['MM_nmb_target'] ?><br>
            <a href="<?php echo $logoutAction ?>">Salir</a>
        </div>
    </div>
    <br style="clear:both"/>
    <div id="convocatoria">
    <div id="cuadro">
    <h1>Convocatoria</h1>
    </div>
    <br>
    <?php 
    if(isset($_SESSION['MM_tp_programa'])&$_SESSION['MM_tp_programa']=="Vigentes"){
        echo "<select name=\"slConvocatoria\">
        <option selected=\"selected\">Seleccione</option>
        <option value=\"empleate\">Empleate</option>
        <option value=\"experimenta\">Experimenta</option>
        <option value=\"mpe\">Mi Primera Empresa</option>
        <option value=\"vecas_vinculacion\">Vecas Vinculación</option>
        </select>
        "	;
    }else{
    echo $_SESSION['MM_tp_programa'];}
    ?>
    
    </div>
</div><!--contenedor derecho-->


</div><!--Boxcontainer-->
  
   
</center>

</body>
</html>

